Skip to content

ci: grep the wheel's METADATA from a file, not a pipe (defensive) - #65

Merged
tomasr78 merged 1 commit into
mainfrom
ci/fix-sigpipe-race
Nov 9, 2026
Merged

tomasr78 merged 1 commit into
mainfrom
ci/fix-sigpipe-race

Conversation

@tomasr78

@tomasr78 tomasr78 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Why

The "Check the packages" step in publish.yml runs unzip -p … METADATA | grep -qx "Version: $VERSION" under set -euo pipefail. That has the shape of the tar | grep -q check that failed at random in convertapi-library-js's main build on 2026-11-09: grep -q exits at its match, and if the writer is still writing, pipefail fails the step.

Unlike the npm checks, this one cannot fail on GitHub's runners today:

  • unzip writes the 6.4 KB METADATA in one write() (strace), so grep cannot exit while unzip is still writing. unzip writes 64 KB at a time.
  • With SIGPIPE ignored, as on the runner, unzip -p ignores EPIPE and exits 0 when its reader leaves early (a 4 MB member piped into head -c 10: 82 writes got EPIPE, exit 0). With the default SIGPIPE disposition, as in a terminal, unzip is killed and the pipeline returns 141.

So a false failure needs a METADATA over 64 KB (a much longer README) and the default SIGPIPE disposition. This change removes both conditions and uses the same pattern as the other SDK workflows. It is defensive: nothing fails today.

Change

METADATA goes to $RUNNER_TEMP/METADATA, then grep -qx "Version: $VERSION" reads the file. A wrong version still fails the step without a message, as before.

Tested

In an Ubuntu 24.04 container (unzip 6.0, GNU grep 3.11, bash 5.2) with SIGPIPE ignored, as on the runner. The step's run: script was read from publish.yml and run with bash -euo pipefail against the wheel and sdist built from main with python -m build (__version__ set to 9.9.9):

Case main this branch
Real wheel, 500 runs 0 failed 0 failed
METADATA padded to 89 KB, 500 runs 0 failed 0 failed
METADATA says Version: 9.9.8 exit 1 exit 1
Wheel without METADATA exit 1 (from grep) exit 11, caution: filename not matched: convertapi-9.9.9.dist-info/METADATA

publish.yml runs only on a release, so it was tested only as above. This PR's Build does not run the changed step.

The fix for the real race: ConvertAPI/convertapi-library-js#31 and ConvertAPI/convertapi-library-node#128. The same defensive change for Java: ConvertAPI/convertapi-library-java#61.

🤖 Generated with Claude Code

`unzip -p ... METADATA | grep -qx "Version: $VERSION"` under pipefail has
the shape of the tar | grep -q check that failed at random in
convertapi-library-js's build on 2026-11-09. Here it cannot fail on
GitHub's runners today: unzip writes the 6 KB METADATA in one write(),
and with SIGPIPE ignored, as on the runner, unzip -p ignores EPIPE and
exits 0. With a METADATA over 64 KB and the default SIGPIPE disposition
it could, so the check now reads a file and depends on neither.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues were identified for the release workflow’s wheel-version check update.

No open issues 🎉

What changed in this PR

This PR defensively updates the release workflow’s wheel-version check to avoid potential SIGPIPE failures under pipefail.

Changes:

  • Extracts wheel METADATA to $RUNNER_TEMP/METADATA before checking its version.
  • Preserves the existing version check and adds a comment explaining why the pipeline is avoided.
File Description
.github/​workflows/​publish.yml Replaces the unzip | grep pipeline with file-based METADATA validation.

Review effort: Balanced

@tomasr78
tomasr78 merged commit b72ebc5 into main Nov 9, 2026
7 checks passed
@tomasr78
tomasr78 deleted the ci/fix-sigpipe-race branch November 9, 2026 15:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants